unary bitwise operators
The unary bitwise operators are ~ aka NOT.
~, NOT
~ and NOT return the bitwise inversion of the following operand. All bits are flipped, so
every zero bit is made a one, and every one bit is made a zero.
unary logical operators
The unary logical operators are ! and !!.
!
! returns the logical NOT of the following operand. If the value of the operand is zero, !
returns $$TRUE (-1) . If the value is any non-zero value, ! returns $$FALSE (0).
!!
!! returns the logical TEST of the following operand. If the value of the operand is zero,
!! returns $$FALSE (0) . If the value is any non-zero value, !! returns $$TRUE (-1).
binary shift operators
The binary shift operators are >>> , <<< , >> , <<.
>>>
>>>, the arithmetic shift right operator, shifts the value of the left integer
operand n bits to the right, where n is the value of the integer operand following the
>>> operator. When the left operand is unsigned, all vacated upper bits are
filled with zeros. When the left operand is signed, all vacated upper bits are filled with
the most significant bit of the original value. >>> is explicitly arithmetic.
<<<
<<< , the arithmetic shift left operator, shifts the value of the left integer
operand n bits to the left, where n is the value of the integer operand to the right of
the <<< operator. All vacated lower bits are filled with zeros, regardless of
data-type. <<< is explicitly arithmetic. The data type of the result is the same
as the shifted integer; if significant bits are shifted out of the integer, they are lost
and no error occurs.
>>
>> , the bitwise shift right operator, shifts the left integer operand n bits to the
right, where n is the value of the integer operand to the right of the >> operator.
All the vacated upper bits are filled with zeros. >> is explicitly bitwise.
<<
<< , the bitwise shift left operator, shifts the left integer operand n bits to the
left, where n is the value of the integer operand to the right of the << operator.
All the vacated lower bits are filled with zero bits. << is explicitly bitwise. The
data type of the result is the same as the shifted integer; if significant bits are
shifted out of the integer, they are lost and no error occurs.